home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: delta / whiteline CD Series - delta.iso / tex / tools / dvi_300b / treiber / sources / vdicp.c < prev   
C/C++ Source or Header  |  1995-11-25  |  4KB  |  65 lines

  1. /**********************************************************                   VDI.C                       ******** VDI-Treiber, gibt (Teil-)Seite ueber GDOS aus **********************************************************//* Geaendert von Thomas Wieschebrink am 23.7.95 */
  2. /* Neu an DVI 3.00 angepaßt 7.10.95 m. Pristovsek */#include <vdi.h>#include <tos.h>
  3. #include <stdlib.h>#define FALSE 0#define TRUE 1/********************************************************************/
  4. long    max_puffer_laenge = 0;
  5.  
  6. #if (__PUREC__<=100)
  7.  
  8. /* VDI */typedef struct{  int  *contrl;    /* Zeiger auf contrl-Array */  int  *intin;     /* Zeiger auf intin-Array  */  int  *ptsin;     /* Zeiger auf ptsin-Array  */  int  *intout;    /* Zeiger auf intout-Array */  int  *ptsout;    /* Zeiger auf ptsout-Array */} VDIPB;
  9. extern void vdi( VDIPB * );
  10.  
  11. #endif
  12.  
  13. /* Neue Routine wegen erweiterter Parameterübergabe */
  14. void vq2_extnd( int handle, int owflag, int *work_out, int weite, int hoehe ){/* ACHTUNG:                                                                                        */
  15. /* Funktioniert SO nur mit PC 1.1!                                         */
  16. /* Ältere Versionen brauchen eine andere Behandlung!    */
  17. /* Die Funktion "vdi()" und die Definition der                 */
  18. /* Parameterblöcke ist sehr stark Bibliotheksabhängig!*/
  19.     VDIPB    vdipb;
  20. #if (__PUREC__<=100)    /* Für Version 1.0 */
  21.     vdipb.contrl = _GemParBlk.contrl;    vdipb.intin  = _GemParBlk.intin;    vdipb.ptsin  = _GemParBlk.ptsin;#else
  22.     vdipb.contrl = _VDIParBlk.contrl;
  23.     vdipb.intin  = _VDIParBlk.intin;    vdipb.ptsin = _VDIParBlk.ptsin;
  24. #endif    vdipb.intout = work_out;    vdipb.ptsout = &(work_out[45]);
  25.   vdipb.contrl[0] = 102;  vdipb.contrl[1] = 0;  if(  vdipb.ptsin[0] > 0  &&  vdipb.ptsin[1] > 0  )    vdipb.contrl[1] = 1;  vdipb.contrl[3] = 1;  vdipb.contrl[6] = handle;
  26.   vdipb.intin[0] = owflag;
  27.   vdipb.ptsin[0] = weite;  vdipb.ptsin[1] = hoehe;    vdi( &vdipb );}
  28. /* 7.10.95 */
  29. /********************************************************************//* Schreibe in DVI-Datei */int drucke( char *p, long start_x, long weite, long hoehe, long h_dpi, long v_dpi, 
  30.                         short fh, short flag, short quer, char *optionen ){  int       i, hdl, work_in[11], work_out[57];  MFDB      bitmap, drucker;
  31.     (void)quer;    /* Ignorieren */
  32.     (void)start_x;
  33.     (void)h_dpi;
  34.     (void)v_dpi;
  35.   if(  vq_gdos()==0  )
  36.   {
  37.       Cconws( "Kein GDOS installiert!\7" );
  38.     return -1;  }
  39.   if(  fh>5  )
  40.   {
  41.       Cconws( "Kann nicht in Dateien drucken!\7" );
  42.     return -1;  }
  43.   if(  flag!=7  )
  44.   {
  45.       Cconws( "Nur ganze Seiten!\7" );
  46.     return -1;  }
  47.  
  48.   /* Und nun die Ausgabe auf Geraet 21 oder neue Unit */    if(  optionen[0]  )
  49.       work_in[0] = (int)atol( optionen );
  50.     if(  work_in[0]<=0  )
  51.       work_in[0] = 21;  for( i = 1; i < 10; i++ )    work_in[i] = 1;  work_in[10] = 2;  v_opnwk( work_in, &hdl, work_out );
  52.     if(  hdl<=0  )
  53.   {
  54.       Cconws( "Gerät läßt sich nicht öffnen!\7" );
  55.     return -1;  }
  56.     
  57.     if(  flag&2  )    {
  58.         /* Seitengroesse setzen */        vq2_extnd( hdl, 0, work_out, (short)weite-1, (short)hoehe-1 );
  59.         bitmap.fd_addr      = p;        bitmap.fd_w         = (int)weite;        bitmap.fd_h         = (int)hoehe;        bitmap.fd_wdwidth   = (int)(weite+15)>>4;        bitmap.fd_stand     = 1;        bitmap.fd_nplanes   = 1;
  60.         /* Adresse wird vom Treiber gesetzt!! */        drucker.fd_addr     = 0;        /* Breite bzw. Hoehe ist ein Pixel mehr!! */        drucker.fd_w        = work_out[0]+1;        drucker.fd_h        = work_out[1]+1;        drucker.fd_wdwidth  = (work_out[0]+16)>>4;        drucker.fd_stand    = 1;        drucker.fd_nplanes  = 1;
  61.         /* work_in als pxyarray missbrauchen */        work_in[0] = work_in[1] = 0;        work_in[4] = work_in[5] = 0;
  62.         work_in[2] = work_in[6] = (int)weite-1;        if(  weite>drucker.fd_w  )            work_in[2] = work_in[6] = drucker.fd_w-1;
  63.         work_in[3] = work_in[7] = (int)hoehe-1;        if(  hoehe>drucker.fd_h  )            work_in[3] = work_in[7] = drucker.fd_h-1;
  64.         /* Bitmap auf Druckerseite kopieren */        vro_cpyfm( hdl, S_ONLY, work_in, &bitmap, &drucker);
  65.         /* drucken */        v_updwk( hdl );    }    if(  flag&4  )        v_form_adv( hdl );    v_clswk( hdl );    return 0;}/* Änderungen 7.10.95 M. Pristovsek */